export default function (date, char) {
  let d = new Date(date)
  let y = d.getFullYear()
  let m = d.getMonth() + 1
  let day = d.getDate()
  return `${y}${char}${addZero(m)}${char}${addZero(day)}`
}

const addZero = n => {
  if (n < 10) {
    return '0' + n
  }

  return n
}
